/*
 * \brief  Client-side nitpicker session interface
 * \author Norman Feske
 * \date   2006-08-23
 */

/*
 * Copyright (C) 2006-2009 Norman Feske
 * Genode Labs, Feske & Helmuth Systementwicklung GbR
 *
 * This file is part of the Genode OS framework, which is distributed
 * under the terms of the GNU General Public License version 2.
 */

#ifndef _INCLUDE__NITPICKER_SESSION__CLIENT_H_
#define _INCLUDE__NITPICKER_SESSION__CLIENT_H_

#include <nitpicker_session/capability.h>
#include <base/ipc.h>

namespace Nitpicker {

	class Session_client : public Session
	{
		private:

			Genode::Msgbuf<256> _snd_msg, _rcv_msg;
			Genode::Ipc_client  _ipc_client;

		public:

			/**
			 * Constructor
			 */
			explicit Session_client(Session_capability session)
			: _ipc_client(session, &_snd_msg, &_rcv_msg) { }


			/*********************************
			 ** Nitpicker session interface **
			 *********************************/

			Framebuffer::Session_capability framebuffer_session()
			{
				Framebuffer::Session_capability result;
				_ipc_client << FRAMEBUFFER_SESSION << Genode::IPC_CALL >> result;
				return result;
			}

			Input::Session_capability input_session()
			{
				Input::Session_capability result;
				_ipc_client << INPUT_SESSION << Genode::IPC_CALL >> result;
				return result;
			}

			View_capability create_view()
			{
				View_capability result;
				_ipc_client << CREATE_VIEW << Genode::IPC_CALL >> result;
				return result;
			}

			void destroy_view(View_capability view) {
				_ipc_client << DESTROY_VIEW << view << Genode::IPC_CALL; }

			int background(View_capability view) {
				return (_ipc_client << BACKGROUND << view << Genode::IPC_CALL); }
	};
}

#endif /* _INCLUDE__NITPICKER_SESSION__CLIENT_H_ */
